<template>
    <div>
        <h1>我是哥哥,我开了一辆{{car}}车</h1>
        <button @click="changeCar">比我大三十岁的女朋友给我换了辆车</button>

    </div>
</template>

<script>
import PubSub from "pubsub-js"
export default {
    name:"Gege",
    data(){
        return {
            car:"八手奥迪",
        };
    },
    methods:{
        changeCar(){
            this.car="二手宝马";
            PubSub.publish("getCar",this.car)

        }
    }
}
</script>